import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 场站列表
export function listStations(){

  return request({
    url: '/system/point/stationList',
    method: 'get',
    params: {}
  })
}

// 查询用户列表
export function listPoint(data) {

  return request({
    url: '/system/point/list',
    method: 'post',
    data: data
  })
}

// 查询详细
export function getPoint(id) {
  return request({
    url: '/system/point/detail?id=' + parseStrEmpty(id),
    method: 'get'
  })
}

// 新增用户
export function addPoint(data) {
  return request({
    url: '/system/point/addPoint',
    method: 'post',
    data: data
  })
}

export function updatePoint(data) {
  return request({
    url: '/system/point/updatePoint',
    method: 'post',
    data: data
  })
}

// 删除用户
export function delPoint(id) {
  return request({
    url: '/system/point/del?id=' + id,
    method: 'get'
  })
}

export function batchDelPoint(ids) {
  const params = {
    'ids': ids
  }
  return request({
    url: '/system/point/batchDel',
    method: 'post',
    data: params
  })
}

export function delPointByStationId(stationId) {
  return request({
    url: '/system/point/stationId=' + stationId,
    method: 'get'
  })
}

// 执行匹配操作
export function matchMapField(id){
  return request({
    url: '/system/point/matchMapField?id='+id,
    method: 'get'
  })
}

export function matchStandardField(id){
  return request({
    url: '/system/point/matchStandardField?id='+id,
    method: 'get'
  })
}


export function handlePointExpression(factor,constant,udf){
  const params = {
    'factor':factor,
    'constant':constant,
    'udf':udf
  }
  return request({
    url: '/system/point/handleExpression',
    method: 'post',
    data: params
  })
}

// 用户状态修改
export function changePointStatus(id, status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/system/point/changeStatus',
    method: 'post',
    data: data
  })
}

